#include <iostream>
#include <vector>
using namespace std;

bool find(vector<int> &v, int target) {
    int left = -1;
    int right = v.size();
    while (left + 1 != right) {
        int mid = left + right;
        mid >>= 1;
        if (v[mid] < target) {
            left = mid;
        } else {
            right = mid;
        }
    }
    if (right == v.size()) {
        return false;
    } else if (v[right] != target) {
        return false;
    } else {
        return true;
    }
}

class Solution {
   public:
    bool findNumberIn2DArray(vector<vector<int>>& matrix, int target) {
        for (vector<int> line : matrix) {
            if (find(line, target)) {
                return true;
            };
        }
        return false;
    }
};

int main() {
    return 0;
}